package com.github.eswrapper.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.eswrapper.model.Response;
import com.github.eswrapper.service.HSSplitIndexManager;

@Controller
@RequestMapping("/hssplitIndex")
public class HSSplitIndexController {

	@Autowired
	private HSSplitIndexManager hssplitIndexManager;

	@RequestMapping(value = "/getResults", method = RequestMethod.POST)
	@ResponseBody
	public Response<String> createHSSplitIndex(@RequestParam(required = false) String clusterName,@RequestParam String indexName, @RequestParam(required = false) int shardNum, @RequestParam(required = false) int replicas,
			@RequestParam(required = false) String delayUnAssign, @RequestParam(required = false) String hotZoneName, @RequestParam(required = false) String stableZoneName) {
			
		return null;

	}

	/**
	 * etl等大批量数据全量导入时，建立读写分离的index库的初始化操作
	 * 
	 * @param indexName
	 * @param shardNum
	 * @param replicas
	 * @param delayUnAssign
	 * @param hotZoneName
	 * @return
	 */
	public Response<String> initHSSplitIndex(@RequestParam(required = false) String clusterName,@RequestParam String indexName, @RequestParam(required = false) int shardNum, @RequestParam(required = false) int replicas,
			@RequestParam(required = false) String delayUnAssign, @RequestParam(required = false) String hotZoneName) {
				return null;

	}

	/**
	 * ETL等大批量数据全量导入时，建立读写分离的index库的结束动作
	 * 
	 * @param indexName
	 * @param hotZoneName
	 * @param stableZoneName
	 * @return
	 */
	public Response<String> destoryHSSplitIndex(@RequestParam(required = false) String clusterName,@RequestParam String indexName, @RequestParam(required = false) String hotZoneName,
			@RequestParam(required = false) String stableZoneName) {
				return null;

	}

	/**
	 * 建立支持路由的type mapping,按照一定路由规则
	 * 
	 * @param indexName
	 * @param typeName
	 * @param mappingStr
	 * @param routingRuleId
	 * @param routingRule
	 * @return
	 */
	public Response<String> createRouteType(@RequestParam(required = false) String clusterName,@RequestParam String typeName, @RequestParam String mappingStr, @RequestParam int routingRuleId, @RequestParam String routingRule) {
		return null;

	}

}
